.class public Lorg/microemu/cldc/SecurityInfoImpl;
.super Ljava/lang/Object;
.source "SecurityInfoImpl.java"

# interfaces
.implements Ljavax/microedition/io/SecurityInfo;


# instance fields
.field private certificate:Ljavax/microedition/pki/Certificate;

.field private cipherSuite:Ljava/lang/String;

.field private protocolName:Ljava/lang/String;


# direct methods
.method public constructor <init>(Ljava/lang/String;Ljava/lang/String;Ljavax/microedition/pki/Certificate;)V
    .locals 0
    .parameter "cipherSuite"
    .parameter "protocolName"
    .parameter "certificate"

    .prologue
    .line 37
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 38
    iput-object p1, p0, Lorg/microemu/cldc/SecurityInfoImpl;->cipherSuite:Ljava/lang/String;

    .line 39
    iput-object p2, p0, Lorg/microemu/cldc/SecurityInfoImpl;->protocolName:Ljava/lang/String;

    .line 40
    iput-object p3, p0, Lorg/microemu/cldc/SecurityInfoImpl;->certificate:Ljavax/microedition/pki/Certificate;

    .line 41
    return-void
.end method


# virtual methods
.method public getCipherSuite()Ljava/lang/String;
    .locals 1

    .prologue
    .line 44
    iget-object v0, p0, Lorg/microemu/cldc/SecurityInfoImpl;->cipherSuite:Ljava/lang/String;

    return-object v0
.end method

.method public getProtocolName()Ljava/lang/String;
    .locals 5

    .prologue
    const-string v4, "TLS"

    const-string v3, "SSL"

    .line 48
    iget-object v1, p0, Lorg/microemu/cldc/SecurityInfoImpl;->protocolName:Ljava/lang/String;

    const-string v2, "TLS"

    invoke-virtual {v1, v4}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z

    move-result v1

    if-eqz v1, :cond_0

    .line 49
    const-string v1, "TLS"

    move-object v1, v4

    .line 51
    :goto_0
    return-object v1

    .line 50
    :cond_0
    iget-object v1, p0, Lorg/microemu/cldc/SecurityInfoImpl;->protocolName:Ljava/lang/String;

    const-string v2, "SSL"

    invoke-virtual {v1, v3}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z

    move-result v1

    if-eqz v1, :cond_1

    .line 51
    const-string v1, "SSL"

    move-object v1, v3

    goto :goto_0

    .line 55
    :cond_1
    :try_start_0
    new-instance v1, Ljava/lang/RuntimeException;

    invoke-direct {v1}, Ljava/lang/RuntimeException;-><init>()V

    throw v1
    :try_end_0
    .catch Ljava/lang/RuntimeException; {:try_start_0 .. :try_end_0} :catch_0

    .line 56
    :catch_0
    move-exception v1

    move-object v0, v1

    .line 57
    .local v0, ex:Ljava/lang/RuntimeException;
    invoke-static {v0}, Lorg/microemu/log/Logger;->error(Ljava/lang/Throwable;)V

    .line 58
    throw v0
.end method

.method public getProtocolVersion()Ljava/lang/String;
    .locals 3

    .prologue
    .line 64
    iget-object v1, p0, Lorg/microemu/cldc/SecurityInfoImpl;->protocolName:Ljava/lang/String;

    const-string v2, "TLS"

    invoke-virtual {v1, v2}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z

    move-result v1

    if-eqz v1, :cond_0

    .line 65
    const-string v1, "3.1"

    .line 67
    :goto_0
    return-object v1

    .line 66
    :cond_0
    invoke-virtual {p0}, Lorg/microemu/cldc/SecurityInfoImpl;->getProtocolName()Ljava/lang/String;

    move-result-object v1

    const-string v2, "SSL"

    invoke-virtual {v1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-eqz v1, :cond_1

    .line 67
    const-string v1, "3.0"

    goto :goto_0

    .line 71
    :cond_1
    :try_start_0
    new-instance v1, Ljava/lang/RuntimeException;

    invoke-direct {v1}, Ljava/lang/RuntimeException;-><init>()V

    throw v1
    :try_end_0
    .catch Ljava/lang/RuntimeException; {:try_start_0 .. :try_end_0} :catch_0

    .line 72
    :catch_0
    move-exception v1

    move-object v0, v1

    .line 73
    .local v0, ex:Ljava/lang/RuntimeException;
    invoke-static {v0}, Lorg/microemu/log/Logger;->error(Ljava/lang/Throwable;)V

    .line 74
    throw v0
.end method

.method public getServerCertificate()Ljavax/microedition/pki/Certificate;
    .locals 1

    .prologue
    .line 80
    iget-object v0, p0, Lorg/microemu/cldc/SecurityInfoImpl;->certificate:Ljavax/microedition/pki/Certificate;

    return-object v0
.end method
